fix: correct regex patterns in roo integration tests#20
Conversation
- Fix newline expectation: tests expected two newlines after frontmatter closing --- but export produces one - Fix field order dependency: split assertions to avoid assuming YAML field order - Fixes line 126-127 and 205 in test/integration/roo.test.ts Co-authored-by: John Lindquist <johnlindquist@users.noreply.github.com>
WalkthroughUpdated integration tests to reflect a change in exported markdown formatting: the YAML frontmatter now directly precedes content without a blank line. Added an assertion to ensure a description field exists in the frontmatter. Adjusted CLI export test expectations accordingly. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code Review: PR #20 - Fix regex patterns in roo integration testsSummaryThis PR fixes test assertions in the Roo integration tests by correcting regex patterns to match the actual output format produced by the ✅ Positive Aspects
🔍 Code Quality AnalysisChanges:
Observations:
🐛 Potential IssuesNone identified. The changes are appropriate and correctly fix the test failures. ⚡ Performance ConsiderationsNo performance impact - these are test-only changes. 🔒 Security ConcernsNo security concerns identified. 🧪 Test CoverageGood: The PR fixes existing test coverage that was incorrectly asserting against the wrong format. The tests now properly validate:
Suggestion: Consider adding an explicit test case that validates the exact format of the exported file to document the expected output format. For example: ```typescript exportToRoo(rules, tempDir) // Should have exactly one newline after closing --- 📝 Additional Observations
✨ Recommendations
VerdictLGTM ✅ - This is a clean, well-scoped fix that addresses real test failures. The changes are correct, improve test reliability, and have no negative impacts. |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
test/integration/roo.test.ts (1)
126-127: LGTM! Well-structured test assertions.The changes correctly address the PR objectives:
- Line 126 now expects a single newline after the frontmatter closing
---instead of two- Line 127 adds an independent assertion for the description field, eliminating dependency on YAML field order
The regex patterns are accurate and the split-assertion approach improves test robustness.
Optional: Consider using the dotall flag for improved readability (ES2018+).
If the codebase targets ES2018 or later, you could replace
[\s\S]*with.*and add thesflag:- expect(publicContent).toMatch(/^---[\s\S]*alwaysApply: true[\s\S]*---\n# Exported Public Content/) - expect(publicContent).toMatch(/^---[\s\S]*description: Exported public rule[\s\S]*---/) + expect(publicContent).toMatch(/^---.*alwaysApply: true.*---\n# Exported Public Content/s) + expect(publicContent).toMatch(/^---.*description: Exported public rule.*---/s)This makes the patterns more readable while maintaining identical functionality.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
test/integration/roo.test.ts(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: claude-review
🔇 Additional comments (1)
test/integration/roo.test.ts (1)
205-205: LGTM! Consistent with other formatting changes.This change correctly updates the CLI export test to expect a single newline after the frontmatter closing
---, consistent with the changes on line 126. The regex pattern accurately validates the exported content format.
Summary by CodeRabbit